import BaseView from "../../../cfw/mvc/BaseView";
import SnowManManager from "../SnowManManager";
import ItemView from "../../item/ItemView";
import SnowManController from "../SnowManController";
import GridLayerListView from "../../../engine/GridLayerListView";
import { SDKEventName } from "../../../sdk/SDKConfig";
import SDKManager from "../../../sdk/SDKManager";


const { ccclass, property } = cc._decorator;

@ccclass
export default class SnowBodyRoomView extends BaseView {

    @property(GridLayerListView)
    listView: GridLayerListView = null;

    protected model: SnowManManager;
    protected controller: SnowManController;

    start() {
        let list = this.model.getBodyList();
        //之所以声明listView  是为了动态色湖之内容数量。如果已知内容数量可以直接在面板设置。
        this.listView.totalCount = list.length;
        SDKManager.getChannel().sendEvent(SDKEventName.entersnow,1)
    }

    //初始化内容
    initListViewItem(listView: GridLayerListView, pos: number, item: cc.Node) {
        let columnList = this.model.getBodyList()
        let comp: ItemView = this.controller.initView(item, 'ItemView', columnList[pos]) as ItemView
        // if (comp.isLoad()) {
        comp.refresh()
        // } else {
        // }
    }
    //调用ListView 的updateItems函数就会触发此函数
    updateListViewItem(node: cc.Node) {

    }

    onButtonBackClick() {
        this.controller.back()
    }
}
